import {FANS_JIA, FANS_JIAN} from '../constants'
const FansCountReducer = (state=25, action) => { // reducer 函数, 加工厂函数
    //根据 action 的类型与数据, 对 state 进行操作, 并返回
    switch(action.type){
        case FANS_JIA:
            return state + action.data;
        case FANS_JIAN:
            return state - action.data;
        //default 必须要设置, 初始化阶段, 会调用函数,获得 state 的初始值
        default: 
            return state;
    }
}

//暴露数据
export default FansCountReducer;